import {Injectable} from "@angular/core";
import {interfaceUrls} from "./serverUrls";
import {AppHttp} from "../util/http";
@Injectable()
export class HomeService{
    constructor(private http: AppHttp){}
    //获取库存列表
    getStockList(param: any): Promise<any> {
        return this.http
            .post(`${interfaceUrls.repertoryList}?pageNo=${param.pageNo}&pageSize=${param.pageSize}`, {});
    }

    getCitiesData(): Promise<any> {
        return this.http.getData('./assets/data/city-data.json')
            .then(data => {
                localStorage.setItem('cityData', JSON.stringify(data));
                return Promise.resolve(data);
            })
            .catch(fail => {
                console.log('异常了', fail);
                return Promise.reject(fail)
            });
    }

}